#!/usr/bin/env python

import os.path
import re

ADMIN_USER_LIST = {'admin':'s13c24', \
                    'fla':'s13c24'}

# WEB MANAGER
WEB = False
WEB_MANAGER_LISTEN_IP = ''
WEB_MANAGER_PORT = 2007

VERSION = '0.1'
#===============================================================================
# update trend pattern
# update blacklist
# squid and havp watcher
#===============================================================================
TIMING_JOB_DICT = {'TrendPatternUpdater':3600, \
                   'BlackListUpdater':600, \
                   'VirusWallWatcher':5, \
                   }

# EXT programs
WGET = 'wget'
UNZIP = 'unzip'
KILLALL = 'killall'

# squid Log rotate
SQUID_LOG_ROATE_INTERVAL = 3600*12 # sec

# squid and havp location
SQUID_PATH = '/usr/local/squid/'

SQUID_CONF_FILEPATH = os.path.normcase(os.path.join(SQUID_PATH, 'etc', 'squid.conf'))

SQUID_RUNCACHE_FILEPATH = os.path.normcase(os.path.join(SQUID_PATH, 'bin', 'RunCache'))

SQUID_DAEMON_FILEPATH = os.path.normcase(os.path.join(SQUID_PATH, 'sbin','squid'))

HAVP_PATH = '/usr/local/'

HAVP_CONF_FILEPATH = os.path.normcase(os.path.join(HAVP_PATH, 'etc', 'havp', 'havp.conf'))

HAVP_BIN_FILEPATH = os.path.normcase(os.path.join(HAVP_PATH, 'sbin', 'havp'))

HAVP_ACCESS_LOG_FILEPATH = '/var/log/havp/access.log'

LOGMARKING_INTERVAL = 10 # sec

UPDATE_BLACKLIST_INTERVAL = 180 # sec
UPDATE_BLACKLIST_STAT = True

UPDATE_VIRUS_PATTERN_INTERVAL = 3600*3 # sec
UPDATE_VIRUS_PATTERN_STAT = True

VIRUS_ROOT_LINK = 'http://support.trendmicro.com.cn/'
RE_VIRUS_PATTERN_OBJ = re.compile('''Anti-Virus/China-Pattern/Pattern/lpt\$vpn_\d{3}.zip''')
VIRUS_PATTERN_PAGE = '''http://support.trendmicro.com.cn/Anti-Virus/China-Pattern/Pattern/'''

BLACKLIST_PAGE = '''http://...'''

#Http and CGI configure
HTDOCS_ROOT_PATH = os.path.normcase(os.path.join(os.getcwd(), 'htdocs'))
TEMPLATE_ROOT_PATH = os.path.normcase(os.path.join(os.getcwd(), 'templates'))
HTTP_LOGS = os.path.normcase(os.path.join(os.getcwd(), 'logs'))

def test():
    print TIMING_JOB_DICT
    print WGET
    print UNZIP
    print SQUID_PATH
    print SQUID_CONF_FILEPATH
    print SQUID_RUNCACHE_FILEPATH
    print HAVP_PATH
    print HAVP_CONF_FILEPATH
    print HAVP_BIN_FILEPATH
    print HAVP_LOG_PATH

if __name__ == '__main__':
    test()
